<?php

/**
 * Description of resultContext
 *
 * This class is simply a wrapper for objects (or functions) to pass back return parameters and additional information
 * about how the operation which it is their responsibility to perform went. 
 * WARNING: I had to make the 3 attributes public, in order for the json_encode method to be able to access those fields.. to correct later.
 * @author NutMotion <simonotm.linux@gmail.com>
 */
class ResultContext {
    /*
     * Indicates whether the operation has succeeded or not
     * @var boolean
     */

    public $success;

    /*
     * This associative array is dedicated to storing one or multiple return parameters for the function.
     * User functions can store any values they need to return in this array. 
     * Warning: As of the current state of the code, this function assumes
     * that the caller function knows what resulting values are supposed to be stored @ which key
     * 
     * Default key is 'default'
     * 
     * @var String[] this is an associative array
     */
    public $arReturnParameter;

    /*
     * This associative array is dedicated to storing one or multiple unformatted text messages, which final audience typically is the user of the application
     * but can be used to feed log messages for example.
     * Same warning as variable $arReturnValues
     * 
     * Default key is 'default'
     * 
     * @var String[] this is an associative array
     */
    public $arFeedbackMsgs;


    
    public $arLogTracks;
    /*
     * The only constructor for this class. Takes a value for each field as parameters
     */

    public function __construct($success, $arReturnParameter, $arFeedbackMsgs) {
        $this->success = $success;
        $this->arReturnParameter=$arReturnParameter;
        $this->arFeedbackMsgs=$arFeedbackMsgs;
        $this->arLogTracks=array();
    }

    /*
     * Below are 3 accessor methods, which provide access to each of the 3 fields of this class
     */
    public function isSuccessful() {
        return $this->success;
    }

    public function getArReturnParameters() {
        return $this->arReturnParameter;
    }

    public function getArFeedbackMsgs() {
        return $this->arFeedbackMsgs;
    }

}

?>
